package com.hn658.base.message.managermq.destination.impl;

import org.apache.activemq.command.ActiveMQTopic;

import com.hn658.base.message.managermq.destination.IMessageDestinationBean;

public class MessageDestinationTopic extends ActiveMQTopic implements IMessageDestinationBean{
	
	protected String name;
	
	protected String destinationName;
	
	public MessageDestinationTopic() {
		
	}
	public MessageDestinationTopic(String value){
		super(value);
	}
	public MessageDestinationTopic(String name, String destinationName) {
		this.name = name;
		this.destinationName = destinationName;
	}
	public String getBeanXml(){
		 StringBuffer buf = new StringBuffer();  
		 buf.append("<bean id=\""+name+"\" class=\"com.hn658.base.message.managermq.destination.impl.MessageDestinationTopic\">")
		 	.append("<constructor-arg value=\""+destinationName+"\"></constructor-arg>")
		 	.append("</bean>");
		 return buf.toString();
	}
	/** 
   * 生成完整的xml字符串 
   * @return 
   */  
	@Override
	  public String getXml(){  
	      StringBuffer buf = new StringBuffer();  
	      buf.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>")  
	          .append("<beans xmlns=\"http://www.springframework.org/schema/beans\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"")  
	          .append("       xmlns:p=\"http://www.springframework.org/schema/p\" xmlns:aop=\"http://www.springframework.org/schema/aop\"")  
	          .append("       xmlns:context=\"http://www.springframework.org/schema/context\" xmlns:jee=\"http://www.springframework.org/schema/jee\"")  
	          .append("       xmlns:tx=\"http://www.springframework.org/schema/tx\"")  
	          .append("       xsi:schemaLocation=\"")  
	          .append("           http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd")  
	          .append("           http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd")  
	          .append("           http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd")  
	          .append("           http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.5.xsd")  
	          .append("           http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd\">")  
	          .append(getBeanXml())  
	          .append("</beans>");  
	      return buf.toString();  
	  }
	@Override
	public String getName() {
		return name;
	}
	@Override
	public void setName(String name) {
		this.name = name;
	}
	@Override
	public String getDestinationName() {
		return destinationName;
	}
	@Override
	public void setDestinationName(String destinationName) {
		this.destinationName = destinationName;
	}
}
